home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir26
/
epi601_2.zip
/
FILES07.EXE
/
SSAMPLE.PGM
< prev
next >
Wrap
Text File
|
1994-08-22
|
2KB
|
51 lines
*SSAMPLE.PGM is a program to take a systematic sample of
*records in a file with a randomly selected starting point. If you
*want to take a 1/5 sample of 75 records, for example, the sample
*will pick a random number from 1 to 15, and start at that record, taking
*every fifth record thereafter. Unlike RSAMPLE.PGM, the size of the
*systematic sample is predictable.
READ ? Name of .REC file to sample: ?
DEFINE DENOM #### GLOBAL
DEFINE START #### GLOBAL
DEFINE REMAINDER ########
CLS
ECHO
ECHO
ECHO This program takes a systematic sample of records in a file,
ECHO starting at a random location.
ECHO
ECHO Please specify a denominator for the sampling fraction.
ECHO To select 1 record out of 20 (a 5% sample), for example,
ECHO you should enter 20 as the denominator...
ECHO
ECHO
ECHO Denominator of sampling fraction:
IMMEDIATE DENOM = ? Must be an integer (e.g., 5,10,20) ?
ECHO
ECHO
*Select starting point
IMMEDIATE START = RAN (DENOM)
TYPE "Taking one record of every @DENOM starting at record @START"
? Press a key to continue ?
*Implement a MOD function
*If START +RECNUMBER is divisible by DENOM without any remainder,
*then select the record
REMAINDER = ((START + RECNUMBER) / DENOM) - ((START + RECNUMBER) DIV DENOM)
SELECT REMAINDER = 0
*Open output file
ERASE SSAMPLE.REC
ROUTE SSAMPLE.REC
WRITE RECFILE NOT DENOM START REMAINDER
*View results
READ SSAMPLE.REC
LIST
TYPE " The records above are contained in file SSAMPLE.REC."
TYPE " If you wish to save the sample, please rename or copy "
TYPE " SSAMPLE.REC before running SSAMPLE.PGM again."
? Press any key to QUIT ?
QUIT